package com.bwie.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;

@Service
//@EnableAsync
public class AsyncService {
    @Async("xty")
    public void sendNotification(){
        System.out.println("线程1进入等待");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程1结束");
    }

    @Async("xty")
    public void sendNotification2(){
        System.out.println("线程2进入等待");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程2结束");
    }
}
